<?php

namespace App\Wechat;

use EasyWeChat\Kernel\Contracts\AccessToken as AccessTokenInterface;
use Illuminate\Support\Facades\Http;

class MyAccessToken implements AccessTokenInterface
{
    public function getToken(): string
    {
        $response = Http::get('http://api.wedoctors.com.cn/wechat/get-access-token');
        $access = $response->json();
        // 你的逻辑
        return $access['token'];
    }

    public function toQuery(): array
    {
        return ['access_token' => $this->getToken()];
    }
}
